package com.wdj.creation.singleton.staticClass;

import com.wdj.creation.singleton.staticfactory.Singleton;

/**
 * @ClassName Singtelon
 * @Description
 * @Author wdj
 * @Date 2020/8/22 10:44
 * @Version 1.0
 **/
public class Singtelon {

    public Singtelon(){}
    private static class HolderClass{
        private  static Singtelon intance = new Singtelon();
    }
    public Singtelon getInstance(){
        return HolderClass.intance;
    }
    public static void main(String[] args) {
        Singleton singleton1 = Singleton.getInstance();
        Singleton singleton2 = Singleton.getInstance();
        System.out.println(singleton1 == singleton2);
        System.out.println(singleton1.equals(singleton2));
    }
}
